home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 7_9.lha / 7_9 / 7_9_ins.c < prev    next >
Text File  |  1993-08-08  |  607b  |  24 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. / DELETE #include "nlink.h"
  6. / insert an entry at the beginning of the list
  7. oid dlist::insert(dlink *a)
  8.  
  9. / DELETE    cout << "dlist::insert(" << (char*)(((nlink*)a)->x) << ")\n";
  10.    if (last)
  11. last->next->insert(a);
  12.  
  13.    else
  14. {
  15. last = a;
  16. last->next = last->prev = last;
  17. }
  18. /DELETE
  19. /DELETE    cout << "\tlast: " << (nlink*)last;
  20. /DELETE    cout << "\tfrom last->next\n";
  21. /DELETE    for (a = last->next; a != last; a = a->next)
  22. /DELETE    cout << "\tnext: " << (nlink*)a;
  23.  
  24.